<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>模板增加</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">
<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"	src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" charset="utf-8" src="../../static/js/Base64.js"></script>
	<script type="text/javascript" charset="utf-8" src="../../static/js/beforeData.js"></script>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<%
	String para =request.getParameter("f_cc_id");
	int f_cc_id = 0;
	if(para != null)
		f_cc_id = Integer.valueOf(para);
	String []nonceObj=ConstantUtils.getNonceObject();
%>
<script type="text/javascript">
var ids = "";
$(function() {
	var f_cc_id = <%=f_cc_id%>;
	var beforeDataJson={};
	$.ajax({
		url:"../../content/select_content.do?f_cc_id="+f_cc_id,
		success:function(data) {
			data = JSON.parse(data);
			$("#f_cc_id").val(data.f_cc_id);
			$("#f_cc_code").val(data.f_cc_code);
			$("#f_cc_name").val(data.f_cc_name);
			$("#f_cc_company_id").val(data.f_cc_companyid);
			ids = data.f_cc_companyid;
			$("#f_cc_company_name").val(data.f_cc_companyname);
			$("#f_cc_searchname").val(data.f_cc_searchname);
			$("#f_cc_tags").val(data.f_cc_tags);
			$("#f_cc_type").val(data.f_cc_type);
			$("#f_cc_desc").val(data.f_cc_desc);
			$("#f_cc_onlinedate").val(data.f_cc_onlinedate.substring(0,19));
			$("#f_cc_offlinedate").val(data.f_cc_offlinedate.substring(0,19));
			$("#f_cc_director").val(data.f_cc_director);
			$("#f_cc_actors").val(data.f_cc_actors);
			$("#f_cc_screenwriter").val(data.f_cc_screenwriter);
			$("#f_cc_end").val(data.f_cc_end);
			$("#f_cc_seriescount").val(data.f_cc_seriescount);
			$("#f_cc_obligate1").val(data.f_cc_obligate1);
			$("#f_cc_obligate2").val(data.f_cc_obligate2);
			$("#f_cc_obligate3").val(data.f_cc_obligate3);
			$("#f_cc_obligate4").val(data.f_cc_obligate4);
			$("#f_cc_definitionflag").val(data.f_cc_definitionflag);
			$("#f_cc_duration").val(data.f_cc_duration);
			$("#f_cc_mediacode").val(data.f_cc_mediacode);
			$("#f_cc_viewindex").val(data.f_cc_viewindex);
			$("#f_cc_isfree").val(data.f_cc_isfree);
			$("#f_cc_status").val(data.f_cc_status);
			setTimeout(function(){
				var pictrue= arrayToJsonBefore();
				data['f_cast_id'] = "";
				data['f_cc_company_name'] = data.f_cc_companyname;
				beforeData(data, f_cc_id, pictrue, "../../beforeData.do");
			},1000);
		}
		
	});
	$("#contentForm").validate({
		rules: {
			f_cc_name: {
				required: true,
				maxlength: 50
			},
			/* f_cc_desc: {
				required: true
			}, */
				f_cc_company_name:{
					required:true
				}
		},
		messages: {
			f_cc_name: {
				required: "请输入模板名称",
				maxlength: "模板名称不能超过50位"
			},
			/* f_cc_desc: {
				required: "请输入路径"
			}, */
				f_cc_company_name:{
					required:"请选择组织"
				}
				
		}
		
	});
});
	function _submitFm() {
		var definitionflag = 0;
		$('input[name="definitionflag"]').each(function(idx, ele){
			definitionflag += $(this).is(':checked')?parseInt($(this).val()):0;
		});
		$('#f_cc_definitionflag').val(definitionflag);
		arrayToJson();
		if($("#contentForm").validate().form()) {
			if($("#picJson").val()!=""&&$("#picJson").val()!="[]"){
				$("#f_cc_viewindex").val(1);
			}
			if(ids!=$("#f_cc_company_id").val()){
				$("#status").val("change");
			}
		app_ajax('../../content/update_content.do', $("#contentForm").serialize(), function(data) {
				if (data.success) {
					$.messager.progress('close');
					$.messager.alert('提示', '提交成功！', 'info', function() {
						parent.$('#dlg').dialog('close');
						parent.gotoSearch($('#easyui-treegrid'));
					});
				} else {
					$.messager.alert('提示', data.result, 'info', function() {
						$.messager.progress('close');
					});
				}
		});
	  }
	}
	
	function bind() {
		openDialog($('#org_list'),'../behavior_control/org_update.jsp?idField=f_cc_company_id&nameField=f_cc_company_name');
		//openDialog($('#dlg'),'org_bind.jsp?chooseid='+$("#f_cc_company_id").val());
	}
</script>
<style type="text/css">
</style>
</head>

<body class="overfwidth">
	<div class="barnavtop">您所在的位置：模板管理 &gt; 模板新增</div>
	<div id="workspace">
		<!--主体 开始-->
		<div id="container-1">
			<div class="editspace">
				<form id="contentForm" class="cmxform" enctype="multipart/form-data" name="formName">
					<input type="hidden" id="f_cc_id" name="f_cc_id" value="0"/>
					<input type="hidden" id="f_cast_id" name="f_cast_id" value=""/>
					<input id="f_cc_onlinedate" name="f_cc_onlinedate" type="hidden" value="2011-04-17 16:34:09" />
					<input id="f_cc_offlinedate" name="f_cc_offlinedate" type="hidden" value="2117-04-17 16:34:09" />
					<input id="f_cc_definitionflag" name="f_cc_definitionflag" type="hidden" value="0" />
					<input id="f_cc_seriescount" name="f_cc_seriescount" type="hidden" value="0" />
					<input id="f_cc_obligate3" name="f_cc_obligate3" type="hidden" value="0" />
					<input id="f_cc_obligate4" name="f_cc_obligate4" type="hidden" value="0" />
					<input id="f_cc_tags" name="f_cc_tags" type="hidden" value="" />
					<input id="f_cc_searchname" name="f_cc_searchname" type="hidden" value="" />
					<input id="f_cc_status" name="f_cc_status" type="hidden" value="2" />
					<input id="f_cc_type" name="f_cc_type" type="hidden" value="20" />
					<input id="f_cc_director" name="f_cc_director" type="hidden" value="${Session.SESSION_USER.f_pu_name}" />
					<input id="f_cc_viewindex" name="f_cc_viewindex" type="hidden" value="0" />
					<%-- <input name="f_cc_companyid" id="f_cc_company_id" type="hidden" value="<%=f_cc_company_id %>" /> --%>  
					<input type="hidden" id="sourceFlag" name="sourceFlag" value="5"/>
					<input type="hidden" id="f_cc_programatype" name="f_cc_programatype" value="1"/>
					<input type="hidden" id="f_cc_obligate1" name="f_cc_obligate1" value=""/>
					<legend style="text-align: center; margin: 0 auto;">模板新增</legend>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>模板名称:
									</td>
									<td width="30%">
										<input id="f_cc_name" name="f_cc_name" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_name_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					 <fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>组织选择:
									</td>
									<td width="30%">
										<input name="f_cc_company_name" id="f_cc_company_name" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
										<input name="f_cc_companyid" id="f_cc_company_id" type="hidden" value="" />  
										<input name="status" id="status" type="hidden" value="nochange" />  
										<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="bind();">选择</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset> 
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										路径:
									</td>
									<td width="30%">
										<input id="f_cc_desc" name="f_cc_desc" readonly="readonly" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_name_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
				
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										&nbsp;模板类型:
									</td>
									<td width="30%">
										<select id="f_cc_end" name="f_cc_end" style="width: 150px;">
											<option value="7" disabled="">广电酒店高清</option>
											<option value="8">中兴百视通公众</option>
											<option value="6" disabled="">广电酒店标清</option>
											<option value="5">百视通温台政企高清</option>
											<option value="13">广电公众高清</option>
											<option value="0" disabled="">百视通酒店标清</option>
											<option value="4">百视通政企高清</option>
											<option value="12">广电公众</option>
											<option value="3" disabled="">百视通温台酒店高清</option>
											<option value="11">中兴广电高清</option>
											<option value="2" disabled="">百视通酒店高清</option>
											<option value="10">中兴广电标清</option>
											<option value="1">百视通政企标清</option>
											<option value="9" disabled="">中兴百视通酒店</option>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					
					
					<fieldset class="hide-item">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										是否通用:
									</td>
									<td width="30%">
										<select id="f_cc_isfree" name="f_cc_isfree" style="width: 150px;">
				                    		<option value="0">通用</option>
				                    		<option value="1">个性</option>
				                    	</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="40%" align="right">
										<jsp:include page="../../pictures/pictures_update_industry.jsp" flush="true">
											<jsp:param value="模板上传" name="picType"/>
											<jsp:param value="2" name="hierarchy"/>
											<jsp:param value="<%=f_cc_id %>" name="f_cp_relationid"/>
										</jsp:include>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
						<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="40%" align="center">
									注：请使用winRAR程序打包zip上传，其他格式与压缩程序打包无法支持
									<a class="easyui-linkbutton"  target="view_frame" href="http://www.winrar.com.cn/">下载地址</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<div class="toolbar" style="text-align: center;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
							href="javascript:void(0);" onclick="_submitFm()">保存</a> <a
							href="javascript:void(0);" data-options="iconCls:'icon-cancel'"
							class="easyui-linkbutton"
							onclick="javascript:parent.$('#dlg').dialog('close')">取消</a>
					</div>
				</form>
			</div>
		</div>
		<!--主体 结束-->
	</div>
	<div id="org_list" class="easyui-dialog"
		style="width: 600px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
</body>
</html>
